package com.cxf.cxfknife4j.service;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.cxf.cxfknife4j.entity.User;
import org.springframework.stereotype.Service;

/**
 * @description: TokenService
 * @date: 2022/3/9 22:16
 * @author: cxf
 * @version: 1.0
 */
@Service
public class TokenService {


    public String getToken(User user) {
        String token="";
        token= JWT.create().withAudience(user.getId())
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }

}
